/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pl.edu.amu.wmi.kino.visualjavafx.javafxcodegenerators.animation.transformations;

import pl.edu.amu.wmi.kino.visualjavafx.javafxcodegenerators.api.Generator;
import pl.edu.amu.wmi.kino.visualjavafx.javafxcodegenerators.helpergenerators.TransformGenerator;
import pl.edu.amu.wmi.kino.visualjavafx.javafxcodegenerators.helpergenerators.TransformParamChecker;
import pl.edu.amu.wmi.kino.visualjavafx.model.animation.transformations.Translation;

/**
 *
 * @author Admin
 */

public class TranslationGenerator implements Generator{

    @Override
    public boolean canGenerate(Object c) {
        if(c instanceof Translation)
            return true;
        else return false;
    }
 
    @Override
    public void generate(StringBuilder sb, Object o,int recursionLevel,Object original) {
        this.generateTranslateX(sb, (Translation)o,recursionLevel);
        this.generateTranslateY(sb, (Translation)o,recursionLevel);
    }

    private void generateTranslateX(StringBuilder sb, Translation t,int recursionLevel){
        
        if(TransformParamChecker.generateParam(t.getHDestination()))
        sb.append(TransformGenerator.transX+recursionLevel+" => "+t.getHDestination()+
                " tween Interpolator."+t.getInterpolations()[0].getName()+",\n");
    }

    private void generateTranslateY(StringBuilder sb, Translation t,int recursionLevel){
        
        if(TransformParamChecker.generateParam(t.getHDestination()))
        sb.append(TransformGenerator.transY+recursionLevel+" => "+t.getVDestination()+
                " tween Interpolator."+t.getInterpolations()[1].getName()+",\n");
    }

}
